package com.online.service.user.Impl;

import com.online.dao.user.Impl.merchantImpl;
import com.online.dao.user.merchantDao;
import com.online.pojo.Bill;
import com.online.pojo.menu;
import com.online.pojo.merchant;
import com.online.service.user.merchantService;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class merchantServiceImpl implements merchantService {
    public List<menu> select(List<menu> list, double price, String type,String name,String shop_name) throws SQLException {
        merchantDao merchantDao=new merchantImpl();
        return merchantDao.select(list,price,type,name,shop_name);
    }

    public boolean insert(String name, String shop_name, double price, String type) {
        merchantDao merchantDao=new merchantImpl();
        return merchantDao.insert(name,shop_name,price,type);
    }

    public merchant login(String name) throws SQLException {
        merchantDao merchantDao=new merchantImpl();

        return merchantDao.select(name);
    }

    public List<menu> select(List<menu> list,String name) throws SQLException {
        merchantDao merchantDao=new merchantImpl();
        return merchantDao.select(list ,name);
    }

    public menu select(menu menu, int id) throws SQLException {
        merchantDao merchantDao=new merchantImpl();
        return merchantDao.select(menu,id);
    }


    public boolean del(int id) throws SQLException {
        merchantDao merchantDao=new merchantImpl();
        return merchantDao.del(id);
    }


    public boolean insert(String shop_name, int shopid, String user_name, double price, int pay) {
        merchantDao merchantDao=new merchantImpl();

        return merchantDao.insert(shop_name,shopid,user_name,price,pay);
    }

    public boolean update(Bill bill) throws SQLException {
        merchantDao merchantDao=new merchantImpl();
        return merchantDao.update(bill);
    }

    public merchant loginUsername(String name) throws SQLException {
        merchantDao merchantDao=new merchantImpl();
        return merchantDao.selectUsername(name);
    }
}
